# Qt Creator部署配置文件
# 用于支持在Qt Creator中一键打包应用程序

# 部署配置
DEPLOY_DIR = $$OUT_PWD/deployment

# Qt运行时库部署
win32 {
    # 使用windeployqt部署Qt运行时库
    QMAKE_POST_LINK += && $$quote($$QMAKE_WINDEPLOYQT $$shell_path($$OUT_PWD/$$TARGET$$TARGET_EXT) $$shell_path($$DEPLOY_DIR))
    
    # 创建部署目录
    QMAKE_POST_LINK += $$quote(mkdir -p $$shell_path($$DEPLOY_DIR))
    
    # 复制可执行文件到部署目录
    QMAKE_POST_LINK += $$quote(cp $$shell_path($$OUT_PWD/$$TARGET$$TARGET_EXT) $$shell_path($$DEPLOY_DIR))
    
    # 复制数据库文件（如果存在）
    exists($$PWD/toy_factory.db) {
        QMAKE_POST_LINK += $$quote(cp $$shell_path($$PWD/toy_factory.db) $$shell_path($$DEPLOY_DIR))
    }
    
    # 复制其他资源文件（如果存在）
    exists($$PWD/resources) {
        QMAKE_POST_LINK += $$quote(cp -r $$shell_path($$PWD/resources) $$shell_path($$DEPLOY_DIR))
    }
}

# 安装目标
install_target.path = $$[QT_INSTALL_EXAMPLES]/oa
INSTALLS += install_target

# 部署目标
deploy_target.path = $$DEPLOY_DIR
INSTALLS += deploy_target